package suit.ui.themes;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;

import suit.ui.Color;
import suit.ui.Gradient;
import suit.ui.Rectangle;
import suit.ui.Theme;
import suit.ui.Widget;

public class ConsoleTheme extends Theme {

	public Color background = new Color(0x000000);
	public Color foreground = new Color(0x008000);
	public Color highlight = new Color(0xFFFFFF);

	public Font labelTextFont = Font.getFont(Font.FACE_PROPORTIONAL,
			Font.STYLE_PLAIN, Font.SIZE_MEDIUM);

	public Font entryTextFont = Font.getFont(Font.FACE_PROPORTIONAL,
			Font.STYLE_PLAIN, Font.SIZE_MEDIUM);

	public void drawButton(Graphics g, Widget object, Rectangle allocation,
			boolean active) {
		g.setColor(foreground.value());
		g.drawRect(allocation.x, allocation.y, allocation.w - 1,
				allocation.h - 1);
		if (active)
			g.drawRect(allocation.x + 2, allocation.y + 2, allocation.w - 5,
					allocation.h - 5);

	}

	public void drawEntry(Graphics g, Widget object, Rectangle allocation) {

		// Highlight
		new Gradient(background.blend(foreground, 0.25), background).paint(g,
				new Rectangle(allocation.x, allocation.y, allocation.w, 10),
				Gradient.Vert);

		g.setColor(foreground.value());
		g.drawRect(allocation.x, allocation.y, allocation.w - 1,
				allocation.h - 1);
	}

	public void setEntryText(Graphics g) {
		g.setColor(foreground.value());
		g.setFont(entryTextFont);
	}

	public void setLabelText(Graphics g) {
		g.setColor(foreground.value());
		g.setFont(labelTextFont);
	}

	public Font getEntryTextFont() {
		return entryTextFont;
	}

	public Font getLabelTextFont() {
		return labelTextFont;
	}

	public void drawProgressBar(Graphics g, Widget object, Rectangle allocation) {
		new Gradient(background, background.blend(foreground, 0.25)).paint(g,
				new Rectangle(allocation.x+1, allocation.y+1, allocation.w-1, allocation.h-3), Gradient.Horiz);
		g.setColor(foreground.value());
		g.drawLine(allocation.x + allocation.w, allocation.y, allocation.x
				+ allocation.w, allocation.y + allocation.h - 1);
	}

	public void drawProgressBorder(Graphics g, Widget object,
			Rectangle allocation) {
		g.setColor(foreground.value());
		g.drawRect(allocation.x, allocation.y, allocation.w - 1,
				allocation.h - 1);
	}

	public void drawListItem(Graphics g, Widget object, Rectangle allocation,
			boolean active) {
		g.setColor(foreground.value());
		g.drawRect(allocation.x, allocation.y, allocation.w - 1,
				allocation.h - 1);
	}

}